package com.yy.factory;

import com.yy.strategy.LoginStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 策略工厂
 */

public class LoginStrategyFactory {

    @Autowired
    private Map<String, LoginStrategy> loginStrategyMap=new HashMap<>();

    /**
     * 根据类型返回策略
     * @param loginType
     * @return
     */
    public LoginStrategy getInstance(String loginType){
        return loginStrategyMap.get(loginType);
    }

}
